-- private, protected, public example
package Example2 is
type Test is class
     -- protected attribute
     class attribute value : integer;

     -- public method
     -- without the following for this example
     -- cannot be compiled correctly.
     -- for signal, variable, constant
         procedure IdontLikeConstants( a : integer );
     -- end for;            
end class Test;
Test base class definition
type TestDeriv is new class Test with
    -- public method
    function IlikeEverything return integer;
end class TestDeriv;
TestDeriv derived class definition
end package Example2;

package body Example2 is
type Test is class body
    -- private attribute
    class attribute privValue : integer;

    -- private method
    function getValue return integer is
        begin
        -- this example makes not much sense, because we have direct access
        -- to privValue and external reference of getValue is not possible.
        return privValue;
    end;

    for signal
        procedure IdontLikeConstants( a : integer ) is
        begin
            value <= a + getValue;
            privValue <= a;
        end;
    end for;
    for variable
        procedure IdontLikeConstants( a : integer ) is
        begin
            value := a + getValue;
            privValue := a;
        end;
    end for;
    for constant
        procedure IdontLikeConstants( a : integer ) is
        begin
            report "cannot set value for a constant object" severity error;
        end;
    end for;
end class body Test;
Implementation for Test
type TestDeriv is class body
    function IlikeEverything return integer is
    begin
        -- returns protected class attribute of base class
        return value;
    end;
end class body TestDeriv;
Implementation for TestDeriv
end package body Example2;